<template>
  <div>
    <div>
      <el-col :span="24">
                <div
          style="
            text-align: center;
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 8px;
          "
        >
          <img src="@/icons/img/changzhi.png" style="width: 40px; height: 40px" />
          {{ this.$store.state.City }}医院<br />
          连续性肾脏替代治疗（CRRT）护理记录单
        </div>
        <div class="bazhu">
          <!--
          <span class="input-item">
            <span>首页行数:</span>
            <el-input
              type="text"
              v-model="printParam.page_rows"
              :clearable="false"
              style="width: 60px; text-align: right; padding-left: 10px"
            ></el-input>
          </span>

          <span class="input-item">
            <span>首页外行数:</span>
            <el-input
              type="text"
              v-model="printParam.second_rows"
              :clearable="false"
              style="width: 60px; text-align: right; padding-left: 10px"
            ></el-input>
          </span>
          -->
          <span class="input-item">
            <span>纸张宽度:</span>
            <el-input
              type="text"
              v-model="printParam.paper_width"
              :clearable="false"
              style="width: 60px; text-align: right; padding-left: 10px"
            ></el-input>
          </span>
          <span class="input-item">
            <span>纸张长度:</span>
            <el-input
              type="text"
              v-model="printParam.paper_height"
              :clearable="false"
              style="width: 60px; text-align: right; padding-left: 10px"
            ></el-input>
          </span>
          <el-button
            type="primary"
            size="small"
            class="input-item"
            @click="saveSetting"
            >设置永久保存</el-button
          >
          <!--
          <el-button
            :loading="queryLoading"
            type="primary"
            size="small"
            class="input-item"
            @click="queryPageAndPrintAll"
            >打印分页查询</el-button
          >
          -->
          <!--
          <el-button
            type="primary"
            size="small"
            @click="printButtonClick"
            class="input-item"
            >打印</el-button
          >
          <el-button
            type="primary"
            size="small"
            @click="printAllButtonClick"
            :loading="loading"
            >自入科开始打印</el-button
          >
          -->
          <el-button
            type="primary"
            size="small"
            @click="printAllButtonClick"
            :loading="loading"
            >打印</el-button
          >
        </div>
        <el-table
          ref="mainTable"
          :data="dataArray"
          :stripe="true"
          style="width: 100%"
          @row-dblclick="rowDbClick"
          :row-class-name="tableRowClassName"
          :cell-class-name="cellClassName"
          :header-cell-style="{
            background: '#F5F7FA',
            color: '#606266',
          }"
          :height="tableHeight"
        >
          <el-table-column label="操作" width="70" align="center">
            <template slot-scope="scope">
              <el-button
                v-if="editIndex != scope.$index && scope.row.id"
                size="medium"
                type="text"
                icon="el-icon-delete"
                @click="deleteButtonClick(scope.$index, scope)"
                style="color: red"
                :disabled="!actionColumnFlag"
              ></el-button>
              <el-button
                v-if="editIndex != scope.$index"
                size="medium"
                type="text"
                icon="el-icon-edit"
                @click="editButtonClick(scope.$index, $event, scope.row)"
                style="color: green"
                :disabled="!actionColumnFlag"
              ></el-button>
              <el-button
                v-if="editIndex == scope.$index"
                size="medium"
                type="text"
                icon="el-icon-back"
                @click="reverseButtonClick(scope.$index)"
                style="color: green"
                :disabled="!actionColumnFlag"
              ></el-button>
              <el-button
                v-if="editIndex == scope.$index"
                size="medium"
                type="text"
                icon="el-icon-check"
                @click="saveButtonClick(scope, scope.$index)"
                style="color: blue"
                :disabled="!actionColumnFlag"
              ></el-button>
            </template>
          </el-table-column>
          <el-table-column
            label="开始日期"
            prop="dataTime"
            width="400"
            align="center"
          >
            <template slot-scope="scope">
              <el-date-picker
                v-if="editIndex == scope.$index"
                v-model="scope.row.dataTime"
                class="dataInputer"
                placeholder=""
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                @input="datetimeChanged('date', scope.$index)"
              />
              <span v-if="editIndex != scope.$index">{{
                scope.row.dataTime
              }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="结束日期"
            prop="endTime"
            width="400"
            align="center"
          >
            <template slot-scope="scope">
              <el-date-picker
                v-if="editIndex == scope.$index"
                v-model="scope.row.endTime"
                class="dataInputer"
                placeholder=""
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                @input="datetimeChanged('date', scope.$index)"
              />
              <span v-if="editIndex != scope.$index">{{
                scope.row.endTime
              }}</span>
            </template>
          </el-table-column>
          <el-table-column label="净超滤量" align="center" width="500">
            <template slot-scope="scope">
              <el-input
                v-if="editIndex == scope.$index"
                v-model="scope.row.ultrafiltrationQuantity"
                style="text-align: center"
                name="template"
                maxlength="255"
              />
              <span v-if="editIndex != scope.$index">{{
                scope.row.ultrafiltrationQuantity
              }}</span>
            </template>
          </el-table-column>

          <el-table-column label="执行人" align="center" width="200">
            <template slot-scope="scope">
              <el-select
                v-if="editIndex == scope.$index"
                v-model="scope.row.signature"
              >
                <el-option
              v-for="item in arrUserName"
              :key="item.id"
              :label="item.user_name"
              :value="item.user_name"
            ></el-option>
              </el-select>
              <span v-if="editIndex != scope.$index">{{
                scope.row.signature
              }}</span>
            </template>
          </el-table-column>
          <!-- <el-table-column label="接班签名" align="center" width="80">
            <template slot-scope="scope">
              <el-select
                filterable
                v-if="editIndex == scope.$index"
                v-model="scope.row.signature_again"
              >
                <el-option
                  v-for="item in arrUserName"
                  :key="item.id"
                  :label="item.user_name"
                  :value="item.sign_path"
                />
              </el-select>
              <span v-if="editIndex != scope.$index">{{
                scope.row.signature_again
              }}</span>
            </template>
          </el-table-column> -->

          <!-- <el-table-column label="操作" width="60" align="center" fixed>
            <template slot-scope="scope">
              <el-button
                v-if="editIndex != scope.$index"
                size="medium"
                type="text"
                icon="el-icon-edit"
                @click="editButtonClick(scope.$index, $event)"
                style="color: green"
              ></el-button>
              <el-button
                v-if="editIndex != scope.$index && scope.row.row_id"
                size="medium"
                type="text"
                icon="el-icon-delete"
                @click="deleteButtonClick(scope.$index, scope)"
                style="color: red"
              ></el-button>

              <el-button
                v-if="editIndex == scope.$index"
                size="medium"
                type="text"
                icon="el-icon-check"
                @click="saveButtonClick(scope, scope.$index)"
                style="color: blue"
              ></el-button>
              <el-button
                v-if="editIndex == scope.$index"
                size="medium"
                type="text"
                icon="el-icon-right"
                @click="reverseButtonClick(scope.$index)"
                style="color: green"
              >
              </el-button>
            </template>
          </el-table-column> -->
          <el-button
            v-if="actionColumnFlag"
            slot="append"
            style="
              width: 100%;
              border-radius: 0;
              border-top: 0;
              border-left: 0;
              border-right: 0;
            "
            @click="appendNew"
            >点击追加一行</el-button
          >
        </el-table>
        <!--
        <div
          style="
            margin-left: 60px;
            margin-right: 10px;
            font-family: '宋体';
            font-size: 14px;
          "
        >
          <p v-html="tailContent" style="text-indent: -1.5cm"></p>
        </div>-->
        <div class="paging">
          <el-pagination
            v-if="pageFlag"
            :current-page="start"
            :page-size="PageSize"
            :pager-count="5"
            layout="total, sizes, prev, pager, next, jumper"
            :total="totalCount"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
          />
        </div>
      </el-col>
      <el-dialog
        title="护理模板选择"
        :visible.sync="dialogVisiblessssssssssss"
        :before-close="handleClose"
      >
        <nursingThree :rowIndex="rowIndex" style="height: auto" />
      </el-dialog>
      <el-dialog
        title="护理模板选择"
        :visible.sync="dijiaguang"
        :before-close="handleClose"
      >
        <nursingDijia :rowIndex="rowIndex" style="height: auto" />
      </el-dialog>
      <el-dialog
        title="护理模板选择"
        :visible.sync="saiwenguang"
        :before-close="handleClose"
      >
        <nursingSaiwen :rowIndex="rowIndex" style="height: auto" />
      </el-dialog>
      <!-- 新增评分 -->
      <el-dialog
        title="新增评分"
        :visible.sync="wanxiangtianying"
        :close-on-click-modal="false"
        class="mod_box"
        custom-class="role-mask"
        style="margin-top: -3%"
        :data="dataArray"
      >
        <el-form ref="form">
          <div class="morse-cri">
            <span class="morse"> Glasgow昏迷评分 </span>
            <span class="Scoring">
              <span>评分时间：</span>
              <el-date-picker
                v-model="timepingfen"
                format="yyyy-MM-dd HH:mm:ss"
                value-format="yyyy-MM-dd HH:mm:ss"
                type="datetime"
                placeholder="选择日期时间"
                @change="timechange(time)"
              >
              </el-date-picker>
            </span>
          </div>
          <el-form-item style="margin-bottom: 15px !important">
            <div
              class="check-group"
              v-for="(item, index) in equipments"
              :key="index"
            >
              <span
                style="
                  padding-right: 10px;
                  font-size: 14px;
                  color: #606266;
                  font-weight: 700;
                "
                >{{ item.scoreItemName }}：</span
              >
              <el-radio-group
                v-model="checkedEquipments[index]"
                @change="handleChange"
              >
                <el-radio
                  v-for="data in item.data"
                  :label="data.score"
                  :key="data.id"
                  :value="data.id"
                  @change="radioChang(data, index)"
                >
                  {{ data.score }}&nbsp;{{ data.scoreItemName }}
                </el-radio>
              </el-radio-group>
            </div>
          </el-form-item>
          <el-form-item
            label="护士签名："
            label-width="82px"
            style="margin-bottom: 15px !important"
          >
            <el-input
              :disabled="true"
              v-model="nursesignature"
              style="text-align: center"
            />
          </el-form-item>
          <el-form-item
            label="护理措施："
            label-width="82px"
            style="margin-bottom: 15px !important"
          >
            <el-select
              v-model="selectvalue"
              multiple
              placeholder="请选择"
              style="width: 60%"
            >
              <el-option
                v-for="item in selectarr"
                :key="item.id"
                :label="item"
                :value="item"
              ></el-option>
            </el-select>
          </el-form-item>
          <!-- <el-form-item
            label="其他措施："
            label-width="82px"
            style="margin-bottom: 15px !important"
          >
            <el-input
              type="textarea"
              style="width: 60%"
              v-model="desc"
            ></el-input>
          </el-form-item> -->
        </el-form>
        <div style="height: 24px; margin: 15px 0px 15px; line-height: 24px">
          <span
            style="
              display: inline-block;
              width: 50%;
              font-size: 16px;
              color: #606266;
              font-weight: 700;
            "
            >总分：{{ this.num }}</span
          >
          <!-- <span
            style="
              display: inline-block;
              width: 50%;
              font-size: 16px;
              color: #606266;
              font-weight: 700;
            "
            >风险等级：{{ this.frameElement }}</span
          > -->
        </div>
        <!-- <span
          style="
            display: inline-block;
            font-size: 16px;
            color: #606266;
            font-weight: 700;
            padding-bottom: 15px;
          "
          >知识库：{{ this.font }}</span
        > -->

        <div slot="footer" class="dialog-footer">
          <el-button @click="wanxiangtianying = false">取 消</el-button>
          <el-button
            :plain="true"
            type="primary"
            @click="(wanxiangtianying = false), preservation()"
            >保 存</el-button
          >
        </div>
      </el-dialog>
    </div>
    <!-- 同步 -->
    <el-dialog title="同步" :visible.sync="dialogVisible" width="30%">
      <span>开始时间：</span>
      <el-date-picker
        v-model="timesynchronism"
        format="yyyy-MM-dd HH:mm:ss"
        value-format="yyyy-MM-dd HH:mm:ss"
        type="datetime"
        placeholder="选择日期时间"
        :disabled="statusover == 0 ? true : false"
      >
      </el-date-picker>
      <div class="over">
        <span>结束时间：</span>
        <el-date-picker
          v-model="timesynchronismover"
          format="yyyy-MM-dd HH:mm:ss"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="datetime"
          placeholder="选择日期时间"
          :disabled="statusover == 0 ? true : false"
        >
        </el-date-picker>
      </div>
      <div class="over">
        <span>频率：</span>
        <el-input
          style="text-align: center"
          name="peep"
          v-model="frequency"
          size="mini"
          :disabled="statusover == 0 ? true : false"
        />
      </div>
      <div class="over">
        <span>状态:</span>
        <el-switch
          v-model="statusover"
          class="switchBtn"
          inactive-text="关闭"
          active-text="启动"
          active-value="0"
          inactive-value="1"
          active-color="#02538C"
          inactive-color="#B9B9B9"
          @change="chageSwith()"
        />
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button
          type="primary"
          @click="(dialogVisible = false), synchronismClick()"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <!-- 自定义 -->
    <el-dialog
      title="自定义出量"
      :visible.sync="dialogVisibleqiangjuan"
      width="30%"
    >
      <div class="overgalaxi">
        <span>自定义出量：</span>
        <el-select
          multiple
          multiple-limit="3"
          v-model="optionIdb"
          size="mini"
          @change="selectChangeBefshuju($event)"
        >
          <el-option
            v-for="item in listArr_"
            :key="item.id"
            :label="item.template_item_name"
            :value="item.template_item_name"
          />
        </el-select>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="selectjiaxuidelei">重 置</el-button>
        <el-button
          type="primary"
          @click="(dialogVisibleqiangjuan = false), selectChangeBef()"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <!-- 自定义内容 -->
    <el-dialog title="出量自定义内容" :visible.sync="zidingyineirong">
      <el-table :data="Zidingyi" style="width: 100%">
        <el-table-column label="自定义列" width="auto">
          <template slot-scope="scope">
            <span v-if="scope.row.fieldChName === 'content_one'">{{
              scope.row.fieldChName === "content_one" ? "自定义列1" : ""
            }}</span>
            <span v-if="scope.row.fieldChName === 'content_two'">{{
              scope.row.fieldChName === "content_two" ? "自定义列2" : ""
            }}</span>
            <span v-if="scope.row.fieldChName === 'content_three'">{{
              scope.row.fieldChName === "content_three" ? "自定义列3" : ""
            }}</span>
            <!-- <span v-if="scope.row.fieldChName === 'content_four'">{{
              scope.row.fieldChName === "content_four" ? "自定义列4" : ""
            }}</span>
            <span v-if="scope.row.fieldChName === 'content_five'">{{
              scope.row.fieldChName === "content_five" ? "自定义列5" : ""
            }}</span> -->
            <!--
              <span v-if="scope.row.fieldChName === 'content_six'">{{
                scope.row.fieldChName === "content_six" ? "自定义列6" : ""
              }}</span>
              <span v-if="scope.row.fieldChName === 'content_seven'">{{
                scope.row.fieldChName === "content_seven" ? "自定义列7" : ""
              }}</span>
              <span v-if="scope.row.fieldChName === 'content_eight'">{{
                scope.row.fieldChName === "content_eight" ? "自定义列8" : ""
              }}</span>
              <span v-if="scope.row.fieldChName === 'content_nine'">{{
                scope.row.fieldChName === "content_nine" ? "自定义列9" : ""
              }}</span>
              <span v-if="scope.row.fieldChName === 'content_ten'">{{
                scope.row.fieldChName === "content_ten" ? "自定义列10" : ""
              }}</span>
              -->
          </template>
        </el-table-column>
        <el-table-column label="列名称" width="auto">
          <template slot-scope="scope">
            <el-input
              v-if="editIndexs == scope.$index"
              v-model="scope.row.fieldName"
              style="text-align: center"
            />
            <span v-if="editIndexs != scope.$index">{{
              scope.row.fieldName
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          property="status"
          label="状态"
          width="auto"
          align="center"
          header-align="center"
        >
          <template scope="scope">
            <el-switch
              v-model="scope.row.status"
              class="tablescope"
              inactive-text="禁用"
              active-text="启用"
              :active-value="1"
              :inactive-value="0"
              active-color="#02538C"
              inactive-color="#B9B9B9"
              disabled
            />
          </template>
        </el-table-column>
        <el-table-column
          fixed="right"
          label="操作"
          width="auto"
          align="center"
          :resizable="false"
        >
          <template slot-scope="scope">
            <el-button-group>
              <el-button
                v-if="editIndexs == scope.$index"
                size="mini"
                @click="handleZidingyi(scope.$index, scope.row, 1)"
                >保存</el-button
              >
              <el-button
                v-if="editIndexs != scope.$index"
                size="mini"
                @click="handleZidingyi(scope.$index, scope.row, 0)"
                >编辑</el-button
              >
            </el-button-group>
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button @click="zidingyineirong = false">取 消</el-button>
        <el-button
          type="primary"
          @click="(zidingyineirong = false), budongmingwang()"
          >确 定</el-button
        >
      </div>
    </el-dialog>
    <!-- 生命打印内容 ------------------------------------------------------------------>
    <div style="visibility: hidden; display: none">
      <div
        style="font-size: 14px; height: 30px; line-height: 30px"
        :id="printParam.title_id"
      >
        <h3
          style="
            width: 100%;
            margin-top: 4px;
            text-align: center;
            font-size: 18px;
            height: 30px;
            line-height: 55px;
          "
        >
          <img src="@/icons/img/changzhi.png" style="width: 30px;height: 30px;vertical-align:middle;"/>{{ this.$store.state.City }}医院 连续性肾脏替代治疗（CRRT）护理记录单
        </h3>
        <div style="margin-right: 15px; float: left; font-size: 14px">
          科室：
          {{
            this.data.department_name === "" ? "" : this.data.department_name
          }}
        </div>
        <div style="margin-right: 15px; float: left; font-size: 14px">
          床号：
          {{ this.data.bed_code === "" ? "" : this.data.bed_code }}
        </div>
        <div style="margin-right: 15px; float: left; font-size: 14px">
          姓名：
          {{ this.data.name === "" ? "" : this.data.name }}
        </div>
        <div style="margin-right: 15px; float: left; font-size: 14px">
          性别：
          {{ this.data.sex === "" ? "" : this.data.sex }}
        </div>
        <div style="margin-right: 15px; float: left; font-size: 14px">
          年龄：
          {{ this.$store.state.user.severFall.ageOrMonthAge}}
        </div>
        <div style="margin-right: 15px; float: left; font-size: 14px">
          住院号：
          {{ this.$store.state.user.severFall.visit_id }}
        </div>
        <div style="margin-right: 15px; float: left; font-size: 14px">
          登记号：
          {{ this.data.visit_id === "" ? "" : this.data.visit_id }}
        </div>
        <div style="margin-right: 15px; float: left; font-size: 14px">
          入科时间：
          {{
            this.data.enter_time === ""
              ? ""
              : this.formattedDate(this.data.enter_time)
          }}
        </div>
        <div style="margin-right: 15px; float: left; font-size: 14px">
          诊断：
          {{ this.data.diagnosis_name }}
        </div>
      </div>
      <el-table
      :id="printParam.table_id"
          ref="mainTable"
          :data="dataArray"
          :stripe="true"
          style="width: 100%"
          @row-dblclick="rowDbClick"
          :row-class-name="tableRowClassName"
          :cell-class-name="cellClassName"
          :header-cell-style="{
            background: '#F5F7FA',
            color: '#606266',
          }"
          :height="tableHeight"
        >
          <el-table-column
            label="开始日期"
            prop="dataTime"
            width="400"
            align="center"
            fixed
          >
            <template slot-scope="scope">
              <el-date-picker
                v-if="editIndex == scope.$index"
                v-model="scope.row.dataTime"
                class="dataInputer"
                placeholder=""
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                @input="datetimeChanged('date', scope.$index)"
              />
              <span v-if="editIndex != scope.$index">{{
                scope.row.dataTime
              }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="结束日期"
            prop="endTime"
            width="400"
            align="center"
            fixed
          >
            <template slot-scope="scope">
              <el-date-picker
                v-if="editIndex == scope.$index"
                v-model="scope.row.endTime"
                class="dataInputer"
                placeholder=""
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                @input="datetimeChanged('date', scope.$index)"
              />
              <span v-if="editIndex != scope.$index">{{
                scope.row.endTime
              }}</span>
            </template>
          </el-table-column>
          <el-table-column label="净超滤量" align="center" width="500">
            <template slot-scope="scope">
              <el-input
                v-if="editIndex == scope.$index"
                v-model="scope.row.ultrafiltrationQuantity"
                style="text-align: center"
                name="template"
                maxlength="255"
              />
              <span v-if="editIndex != scope.$index">{{
                scope.row.ultrafiltrationQuantity
              }}</span>
            </template>
          </el-table-column>

          <el-table-column label="执行人" align="center" width="200">
            <template slot-scope="scope">
              <el-select
                filterable
                remote
                v-if="editIndex == scope.$index"
                v-model="scope.row.signature"
                @keydown.enter.native="xibanya(scope)"
              >
                <el-option
                  v-for="item in arrUserName"
                  :key="item.id"
                  :label="item.user_name"
                  :value="item.user_name"
                  :disabled="item.disabled"
                />
              </el-select>
              <span v-if="editIndex != scope.$index">{{
                scope.row.signature
              }}</span>
            </template>
          </el-table-column>
          <el-button
            v-if="actionColumnFlag"
            slot="append"
            style="
              width: 100%;
              border-radius: 0;
              border-top: 0;
              border-left: 0;
              border-right: 0;
            "
            @click="appendNew"
            >点击追加一行</el-button
          >
        </el-table>
      <!-- <div
        id="tailsign"
        style="
          margin-left: 60px;
          margin-right: 10px;
          font-family: '宋体';
          font-size: 14px;
        "
      >
        <p v-html="tailContent" style="text-indent: -1.5cm"></p>
        <span style="margin-right: 100px; float: right"
          >护士签名:____________</span
        >
      </div> -->
    </div>
  </div>
</template>

<script>
import { jyxdPrint } from "../../utils/jyxd-printer";
import nursingThree from "@/views/nursingDocument/nursingThree.vue";
import nursingDijia from "@/views/nursingDocument/nursingDijia.vue";
import nursingSaiwen from "@/views/nursingDocument/nursingSaiwen.vue";
import {
  getCodeListByName,
  getUserListByUserType,
  vitalSignGetList,
  vitalSignqueryListxin,
  vitalSignSaveData,
  vitalSignSaveDataxin,
  vitalSignDonggandidai,
  vitalSignDeleteData,
  vitalSignShanluing,
  getListByScoreName,
  getShengMing,
  getPatientScoreList,
  syncMonitorData,
  getCustomFieldList,
  getListlei,
  updateDefaultPage,
  NursingUpdateOnOrOff,
  getCommonSettingByPatientId,
  openPulseRecord,
  queryDataMaibo,
  patientgetList,
  usergetList,
  getUser,
  queryList,
  getPrimaryCareList,
  handGaiedit,
  handGaieditdelete,
  crrtNurseinsertThree,
  crrtNursedelete,
  crrtNursequeryThreeList,
} from "@/api/table";
import { Message } from "element-ui";
export default {
  props: {
    settings: {
      type: Object,
    },
  },
  components: {
    nursingThree,
    nursingDijia,
    nursingSaiwen,
  },
  data() {
    return {
      template: "",
      hr: "",
      rowIndex: "",
      age:"",
      printParam: {
        table_id: "mytableVV", //表实体div id，<el-table>表内容不能全空，至少有一行，即使是空行
        title_id: "myheaderVV", //表前抬头栏div 的id，如果没有或不需打印，去除此变量或置空或置"无"
        //tail_id: "tailsign", //表后签字栏div 的id，如果没有或不需打印，去除此变量或置空或置"无"

        page_rows: 9, //首页行数，0，表示不分页
        second_rows: 8, //首页之外各页的行数，只在首页打印抬头的话首页行数和其它页行数会不同

        paper_height: "1560", //纸张长度，设为大于500的值表示自动按纸张长度分页，设其它值都按每页行数分页。
        //例如A4纸长度大概在1040-1400之间。
        //纸张长度分页优于按行数分页，设置纸张长度后，每页行数的设置被忽略不用。
        //严重折行的表格按纸张长度分页可能会造成分页错误，预览到错误后可以调整纸张长度纠正。
        paper_width: "1050",

        table_head: "", //非el-table表的表头id，表前部不变部分，用<tbody id=>  </tbody>括起来
        table_body: "", //非el-table表的表体id，填充数据部分，用<tbody id=>  </tbody>括起来
        table_foot: "", //非el-table表的表脚id，表里不变部分，用<tbody id=>  </tbody>括起来

        button: "", //是否打印按钮，置"button"或"打印"表示输出按钮，去除此变量或置空将隐藏所有按钮
        title: "", //是否每页都要页面抬头，置"first"或"首页"表示只有首页打印抬头，去除此变量或置空所有页面都有抬头
        tail: "", //是否每页都要页面签字栏，置"first"或"首页"表示只有首页打印签字栏，去除此变量或置空所有页面都有签字栏

        blank: 0, //打印空表页数，空表保留所有上述格式，内容为空。0表示打印实际数据表。
        hidden_col: "", //隐藏列号范围，如 "0,2-4,9"，列号从0起计，去除此变量或置空表示打印所有列。复杂表头暂不支持列隐藏。

        preview: "预览", //是否仅仅预览？置"预览"表示仅展示在屏幕上，置空表示表示直接调用print()。
        thead_style: "font-size:15px",
        tbody_style: "font-size:15px",
        debug: "no", //不打印debug信息
      },
      zidingyineirong: false,
      Zidingyi: [
        {
          id: "",
          fieldChName: "content_one",
          fieldName: "",
          status: 1,
          associatedTable: "table_in_out_amount",
          patientId: "",
        },
        {
          id: "",
          fieldChName: "content_two",
          fieldName: "",
          status: 1,
          associatedTable: "table_in_out_amount",
          patientId: "",
        },
        {
          id: "",
          fieldChName: "content_three",
          fieldName: "",
          status: 1,
          associatedTable: "table_in_out_amount",
          patientId: "",
        },
      ],
      optionIdb: [],
      shuizhenbi: "",
      hulige: "",
      xinshidai: "",
      editIndexs: -1,
      xinshijieoo: [],
      shuizhenbitwo: "",
      settingName: "vital-sign-settings",
      data: this.$store.state.user.severFall,
      user_name: "小王",
      jinwu: [],
      lunmu: [],
      equipmentsss: ["1", "2", "3", "4", "5"],
      //父参
      loading: false,
      queryLoading: false,
      printArray: [],
      //-----------------编辑用

      dataArray: [], //表格数据
      editIndex: -1, //编辑行号，从0开始
      lastRowData: {}, //保存回滚值
      editRowHeight: 28, //行高
      revisableDays: 2, //指定多少天前的数据被保护，不允许修改删除
      aheadMinutes: 10, //允许提前多少分钟录入数据，即可以选择未来的时刻
      ignoredKeys: ["index", "date", "time", "signature"], //判是否空行时忽略不计的变量名
      //动态列定义，来自接口
      columnList0: ["测一", "-", "测二"],
      columnList: [
        { lable: "呕吐", field_name: "content_one" },
        { lable: "出血", field_name: "content_ten" },
      ],
      //值变化的列
      changedFields: [], //哪些列的值被修改了？
      dateFormat: "yy-MM-dd", //显示日期格式
      tailContent: "",
      lastDate: "",
      tableHeight: 1000,
      tengtong: [
        {
          id: "0",
          value: "1",
          label: "否",
        },
        {
          id: "1",
          value: "2",
          label: "是",
        },
      ],
      arrTypelist: [],
      optionVersionBef: [
        {
          id: "0",
          value: "大嘴",
          label: "大嘴",
        },
        {
          id: "1",
          value: "小郭",
          label: "小郭",
        },
        {
          id: "2",
          value: "佟湘玉",
          label: "佟湘玉",
        },
      ],
      heartList: [
        {
          id: "0",
          value: "1",
          label: "不齐",
        },
        {
          id: "1",
          value: "2",
          label: "齐",
        },
      ],
      yaxigou: [
        {
          id: "0",
          value: "1",
          label: "否",
        },
        {
          id: "1",
          value: "2",
          label: "是",
        },
      ],
      //---------------------------------------
      // printParam: {
      //   page_rows: 18,
      //   second_rows: 20,
      //   paper_height: 1040,
      // },
      arrUserName: [],
      huxiyinbeizhu: "",
      arrList: [],
      arrListru: [],
      listArr_: [],
      arrListgeiyao: [],
      shenzhi: [],
      pupleft: [],
      templateType: "",
      pupright: [],
      light: [],
      heart: [],
      airWay: [],
      rsModels: [],
      huxiyin: [],
      xiyan: [],
      wanxiangtianying: false,
      timepingfen: "",
      equipments: [],
      changedObjList: [],
      num: 0,
      selectarr: [],
      selectvalue: "",
      checkedEquipments: [],
      nursesignature: "",
      timesynchronism: "",
      timesynchronismover: "",
      frequency: "",
      statusover: 0,
      statusmaibo: true,
      itemId: [],
      dialogVisible: false,
      dialogVisiblessssssssssss: false,
      dialogVisibleqiangjuan: false,
      dijiaguang: false,
      saiwenguang: false,
      parentId: [],
      radioChekObj: {},
      lightReflectionLeft: "",
      lightReflectionRight: "",
      heimeisu: "",
      pupilRight: "",
      pupilLeft: "",
      consciousness: "",
      idsss: "",
      usergonghao: "",
      yewan: "",
      actionColumnFlag: true,
      start: 1, // 默认显示第几页
      totalCount: 0, // 总条数，根据接口获取数据长度(注意 : 这里不能为空)
      pgeSizes: [10, 20, 30, 40], // 个数选择器（可修改）
      PageSize: 10, // 默认每页显示的条数（可修改）
      pageFlag: false,
      logLevel: "",
    };
  },
  computed: {
    getData() {
      return this.$store.state.user.severFall;
    },
  },
  watch: {
    settings(nVal) {
      //this.localSettings = nVal;
      this.queryVitalSign();
    },
    getData() {
      this.data = this.$store.state.user.severFall;
      if (this.data.visit_time != undefined && this.data.visit_time != "") {
        this.data.visit_time = this.data.visit_time.slice(0, 10);
      }
      if(this.data.unplanned=="" || this.data.unplanned==null || this.data.unplanned==0){
        this.$message({
          message: "请在首页补全患者信息",
          type: "warning",
          duration: 1500
        });
      }else{
        this.queryVitalSign();
      }
    },
  },
  mounted() {
    this.$nextTick(function () {});
    getUser().then((res) => {
      this.usergonghao = res.data.workNumber;
    });
    this.data = this.$store.state.user.severFall;
    if (this.data.visit_time != undefined && this.data.visit_time != "") {
      this.data.visit_time = this.data.visit_time.slice(0, 10);
    }
    if(this.data.unplanned=="" || this.data.unplanned==null || this.data.unplanned==0){
      this.$message({
        message: "请在首页补全患者信息",
        type: "warning",
        duration: 1500
      });
    }
    this.user_name = this.$store.state.user.name;
    this.user_namesss = this.$store.state.user.work_number;
    this.readSetting();
    patientgetList({ visitId: this.data.visit_id }).then((res) => {
      this.heimeisu = res.data[0].diagnosis_name;
      if(res.data[0].age!==''){
          this.age = res.data[0].age;
        }
    });
    if (
      typeof this.data.patient_id == "string" &&
      this.data.patient_id.length > 0
    ) {
      setTimeout(() => {
        this.queryVitalSign();
      }, 0);
    }

    //获取所有选择项
    // setTimeout(() => {
    //   this.getAllOptions();
    // }, 0);
    this.getAllOptions();
    // let _this = this;
    /**
    setTimeout(() => {
      _this.getTailContent();
    }, 8000);
    **/
    this.editIndex = -1;
    /**
    getShengMing({ status: 1, commonName: "呼吸音" }).then((res) => {
      this.huxiyinbeizhu = res.data;
    });
    **/
    setTimeout(() => {
      if (typeof self.$refs.mainTable != "undefined") {
        this.tableHeight =
          window.innerHeight - this.$refs.mainTable.$el.offsetTop - 300;
      }
    }, 3000);
    let self = this;
    window.onresize = function () {
      if (typeof self.$refs.mainTable != "undefined") {
        self.tableHeight =
          window.innerHeight - self.$refs.mainTable.$el.offsetTop - 300;
      }
    };
    this.maibokai();
  },
  created() {
    eventBus.$on("selectTemplateValue", (row) => {
      console.log(
        this.dataArray,
        "呀呀呀呀呀呀1",
        row.rowIndex,
        "呀呀呀呀呀呀2",
        this.dataArray[row.rowIndex],
        "睡吧",
        this.dataArray[row.rowIndex].nursingAssessment,
        "呀呀呀呀呀呀3",
        row,
        "呀呀呀呀呀呀4",
        row.val
      );
      this.dataArray[row.rowIndex].nursingAssessment = row.val;
      this.hulige = row.val;
      this.dataArray[row.rowIndex].nursingAssessment = this.hulige;
      this.dialogVisiblessssssssssss = false;
    });
    eventBus.$on("selectTemplateValuew", (row) => {
      console.log(
        this.dataArray,
        "呀呀呀呀呀呀1",
        row.rowIndex,
        "呀呀呀呀呀呀2",
        this.dataArray[row.rowIndex],
        "睡吧",
        this.dataArray[row.rowIndex].bak5,
        "呀呀呀呀呀呀3",
        row,
        "呀呀呀呀呀呀4",
        row.val
      );
      this.dataArray[row.rowIndex].bak5 = row.val;
      this.hulige = row.val;
      this.dataArray[row.rowIndex].bak5 = this.hulige;
      this.saiwenguang = false;
    });
    this.data = this.$store.state.user.severFall;
                patientgetList({ visitId: this.data.visit_id }).then((res) => {
        if(res.data[0].age!==''){
          this.age = res.data[0].age;
        }
    });
  },
  methods: {
    //自定义编辑
    handleZidingyi(index, row, status) {
      switch (status) {
        case 0:
          this.editIndexs = index;
          break;
        case 1:
          handGaiedit({
            fieldChName: row.fieldChName,
            fieldName: row.fieldName,
            status: row.status,
            id: row.id,
            patientId: this.data.patient_id,
            associatedTable: "table_in_out_amount",
          }).then((res) => {
            this.Customize();
          });
          this.editIndexs = -1;
          break;
      }
    },
    queryTemplateList(pageSize, start) {
      if (this.templateType != "") {
        getListlei({
          size: pageSize,
          start: start,
          templateItemName: this.templateName,
          templateId: this.templateType,
          status: 1,
          operatorCode: this.operatorCode,
        }).then((res) => {
          this.listArr_ = res.data;
          this.totalCount = res.totalCount;
          console.log(this.listArr_, "睡觉吧");
        });
      }
    },
    selectTypeList() {
      queryList({
        status: 1,
      }).then((res) => {
        this.arrTypelist = res.data;
        for (let ji = 0; ji < this.arrTypelist.length; ji++) {
          if (this.arrTypelist[ji].dict_template_name == "自定义出量") {
            this.templateType = this.arrTypelist[ji].id;
          }
        }
        this.queryTemplateList(this.PageSize, this.start);
      });
    },
    selectChangeBefshuju(dazuiwa) {
      this.xinshijieoo = dazuiwa;
      console.log(this.xinshijieoo, "带你飞哦");
    },
    selectjiaxuidelei() {
      for (var k = 0; k < this.Zidingyi.length; k++) {
        if (this.Zidingyi[k].id) {
          handGaieditdelete([this.Zidingyi[k].id]).then((res) => {
            this.Customize();
            this.dialogVisibleqiangjuan = false;
          });
        }
      }
    },
    selectChangeBef() {
      console.log(this.xinshijieoo, "睡觉吧");
      if (this.xinshijieoo != [] && this.xinshijieoo.length > 0) {
        console.log("飞机大炮");
        // for (var jizai = 0; jizai < this.listArr_.length; jizai++) {
        //   for (var l = 0; l < this.Zidingyi.length; l++) {
        //     console.log("狗粉1", laobai[jizai]);
        //     console.log("狗粉2", this.Zidingyi[l].fieldName);
        //     console.log(
        //       "狗粉2333333333333333333333",
        //       laobai[jizai].indexOf(this.Zidingyi[l].fieldName) != -1
        //     );
        //     if (this.Zidingyi[l].fieldName != laobai[jizai] ) {
        //       this.Zidingyi[l].fieldName = laobai[jizai];
        //     } else {
        //       this.Zidingyi[l].fieldName = "";
        //     }
        //     // if (this.Zidingyi[1].fieldName.indexOf(laobai[jizai]) != -1) {
        //     //   this.Zidingyi[1].fieldName = laobai[jizai];
        //     // } else {
        //     //   this.Zidingyi[1].fieldName = "";
        //     // }
        //     // if (this.Zidingyi[2].fieldName.indexOf(laobai[jizai]) != -1) {
        //     //   this.Zidingyi[2].fieldName = laobai[jizai];
        //     // } else {
        //     //   this.Zidingyi[2].fieldName = "";
        //     // }
        //     // if (laobai[jizai].indexOf(this.Zidingyi[1].fieldName) != -1) {
        //     //   this.Zidingyi[1].fieldName = laobai[jizai];
        //     // } else {
        //     //   this.Zidingyi[1].fieldName = "";
        //     // }
        //     //  if (laobai[jizai].indexOf(this.Zidingyi[2].fieldName) != -1) {
        //     //   this.Zidingyi[2].fieldName = laobai[jizai];
        //     // } else {
        //     //   this.Zidingyi[2].fieldName = "";
        //     // }
        //   }
        // }
        for (var jizai = 0; jizai < this.listArr_.length; jizai++) {
          this.Zidingyi[jizai].fieldName = this.xinshijieoo[jizai];
        }
      }
      this.optionIdb = this.xinshijieoo;
      console.log("攻打几款iguo", this.optionIdb);
      this.lunmu = [
        {
          fieldChName: this.Zidingyi[0].fieldChName,
          fieldName: this.Zidingyi[0].fieldName || "",
          status: 1,
          id: this.Zidingyi[0].id,
          patientId: this.Zidingyi[0].patientId || this.data.patient_id,
          associatedTable: "table_in_out_amount",
        },
        {
          fieldChName: this.Zidingyi[1].fieldChName,
          fieldName: this.Zidingyi[1].fieldName || "",
          status: 1,
          id: this.Zidingyi[1].id,
          patientId: this.Zidingyi[1].patientId || this.data.patient_id,
          associatedTable: "table_in_out_amount",
        },
        {
          fieldChName: this.Zidingyi[2].fieldChName,
          fieldName: this.Zidingyi[2].fieldName || "",
          status: 1,
          id: this.Zidingyi[2].id,
          patientId: this.Zidingyi[2].patientId || this.data.patient_id,
          associatedTable: "table_in_out_amount",
        },
      ];
      console.log(this.lunmu, "转你吗");
      let list = [];
      list = this.lunmu;
      handGaiedit(list).then((res) => {
        this.Customize();
      });
    },
    //自定义功能
    Customize() {
      //自定义
      getCustomFieldList({
        associatedTable: "table_in_out_amount",
        patientId: this.data.patient_id,
      }).then((res) => {
        if (res.list != null && res.list.length > 0) {
          for (var l = 0; l < this.Zidingyi.length; l++) {
            for (var k = 0; k < res.list.length; k++) {
              if (
                this.Zidingyi[l].fieldChName === res.list[k].fieldChName &&
                res.list[k].status == 1
              ) {
                this.Zidingyi[l].fieldName = res.list[k].fieldName;
                this.Zidingyi[l].id = res.list[k].id;
                this.Zidingyi[l].fieldChName = res.list[k].fieldChName;
                this.Zidingyi[l].patientId = res.list[k].patientId;
                //this.Zidingyi[l].status = res.list[k].status;
                //this.Zidingyi[l].sort = res.list[k].sort;
              }
            }
          }
        } else {
          this.Zidingyi = [
            {
              id: "",
              fieldChName: "content_one",
              fieldName: "",
              status: 1,
              associatedTable: "table_in_out_amount",
              patientId: this.data.patient_id,
            },
            {
              id: "",
              fieldChName: "content_two",
              fieldName: "",
              status: 1,
              associatedTable: "table_in_out_amount",
              patientId: this.data.patient_id,
            },
            {
              id: "",
              fieldChName: "content_three",
              fieldName: "",
              status: 1,
              associatedTable: "table_in_out_amount",
              patientId: this.data.patient_id,
            },
          ];
        }
        this.optionIdb = [];
        for (var l = 0; l < res.list.length; l++) {
          if (res.list[l].fieldName != "") {
            this.optionIdb.push(res.list[l].fieldName);
          }
        }
        console.log("大西瓜233333", this.optionIdb);
      });
    },
    //打印分页查询begin=============================================
    queryPageAndPrintAll(PageSize, start) {
      this.start = 1;
      this.queryPageAndPrintAllCommon(this.PageSize, this.start);
    },
    queryPageAndPrintAllCommon(PageSize, start) {
      (this.queryLoading = true),
        //显示分页按钮
        (this.pageFlag = true);
      this.data = this.$store.state.user.severFall;
      var dtStr =
        this.formattedDate(this.data.enter_time).slice(0, 10) + " 00:00:00";
      var hours = this.getHours(this.data.enter_time);
      var thus = this;
      vitalSignGetList({
        patientId: this.data.patient_id,
        startTime: dtStr,
        hour: hours,
        size: PageSize,
        start: start,
      })
        .then((res) => {
          if (res.data) {
            thus.dataArray = res.data;
            this.totalCount = res.totalCount;
            //隐藏操作列
            this.actionColumnFlag = false;
            thus.queryLoading = false;
          } else {
            this.queryLoading = false;
            this.dataArray = [];
            alert("未查询到打印数据!");
          }
        })
        .catch((err) => {
          this.queryLoading = false;
        });
    },
    selectTemplate(index) {
      this.dialogVisiblessssssssssss = true;
      this.rowIndex = index;
    },
    selectTemplatedijia(index) {
      this.dijiaguang = true;
      this.rowIndex = index;
    },
    selectTemplatesaiwen(index) {
      this.saiwenguang = true;
      this.rowIndex = index;
    },
    handleClose(done) {
      this.$confirm("确定关闭吗")
        .then(() => {
          done();
        })
        .catch(() => {});
    },
    // 每页显示的条数
    handleSizeChange(val) {
      this.PageSize = val;
      this.start = 1;
      this.queryPageAndPrintAllCommon(val, this.start);
    },
    // 显示第几页
    handleCurrentChange(val) {
      this.start = val;
      this.queryPageAndPrintAllCommon(this.PageSize, this.start);
    },
    //打印分页查询end=============================================
    //日期比较的方法 2020-11-15 17:59:20’;
    compare(date1, date2) {
      let dates1 = new Date(date1);
      let dates2 = new Date(date2);
      if (dates1 > dates2) {
        return true;
      } else {
        return false;
      }
    },
    openFullScreen2() {
      const loading = this.$loading({
        lock: true,
        text: "Loading",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      setTimeout(() => {
        loading.close();
      }, 3000);
    },
    maibokai() {
      queryDataMaibo({
        id: this.data.patient_id,
      }).then((res) => {
        this.statusmaibo = res.data.isOpenPulseRecord;
      });
    },
    //吕梁,自入科以来全打印
    printAllButtonClick() {
      this.queryAndPrintAll();
    },
    printButtonClick() {
      this.editIndex = -1;
      this.printArray = this.dataArray;
      this.$nextTick(function () {
        this.printOut();
      });
    },
    printOut() {
      jyxdPrint(this.printParam);
      this.printArray = [];
    },
    remoteMethod(query) {
      this.shuizhenbi = query;
    },
    remoteMethodtwo(query) {
      this.shuizhenbitwo = query;
    },
    xibanya(scope) {
      usergetList({
        workNumber: this.usergonghao,
      }).then((res) => {
        if (res.data[0].sign_path[0].url == "") {
          Message({
            message: "该用户没有签名图片",
            type: "warning",
            duration: 1500,
          });
          return;
        }
        scope.row.signature = res.data[0].user_name;
        //scope.row.signature = res.data[0].sign_path[0].url;
      });
    },
    xibanyatwo(scope) {
      usergetList({
        workNumber: this.usergonghao,
      }).then((res) => {
        if (res.data[0].sign_path[0].url == "") {
          Message({
            message: "该用户没有签名图片",
            type: "warning",
            duration: 1500,
          });
          return;
        }
        scope.row.signature_again = res.data[0].user_name;
        scope.row.signature_again = res.data[0].sign_path[0].url;
      });
    },
    saveSetting() {
      this.correctPrintSettings();

      localStorage.setItem(this.settingName, JSON.stringify(this.printParam));
      this.$message({ message: "已保存", type: "success", duration: 800 });
    },
    readSetting() {
      var str = localStorage.getItem(this.settingName);
      if (str == null) {
        this.printParam.page_rows = "18";
        this.printParam.second_rows = "20";
        this.printParam.paper_height = "1560";
        this.printParam.paper_width = "1050";
      } else {
        var json = JSON.parse(str);
        if (json != null) {
          this.printParam.page_rows = json.page_rows;
          this.printParam.second_rows = json.second_rows;
          this.printParam.paper_height = json.paper_height;
          this.printParam.paper_width = json.paper_width;
        }
      }
    },
    correctPrintSettings() {
      var pageRows = parseInt(this.printParam.page_rows);
      if (isNaN(pageRows) || pageRows < 1) {
        this.printParam.page_rows = 17;
      }
      var pageRows = parseInt(this.printParam.second_rows);
      if (isNaN(pageRows) || pageRows < 1) {
        this.printParam.second_rows = 17;
      }
      var paperHeight = parseInt(this.printParam.paper_height);
      if (isNaN(paperHeight)) {
        this.printParam.paper_height = 0;
      }
    },
    //同步
    synchronism() {
      var date = new Date();
      //年
      var year = date.getFullYear();
      //月
      var month = date.getMonth() + 1;
      //日
      var day = date.getDate();
      //时
      var hh = date.getHours();
      //分
      var mm = date.getMinutes();
      //秒
      var ss = date.getSeconds();
      if (Number(month) < 10) {
        month = "0" + month;
      }
      if (Number(day) < 10) {
        day = "0" + day;
      }
      if (Number(hh) < 10) {
        hh = "0" + hh;
      }
      if (Number(mm) < 10) {
        mm = "0" + mm;
      }
      if (Number(ss) < 10) {
        ss = "0" + ss;
      }
      getCommonSettingByPatientId({
        patientId: this.data.patient_id,
        settingType: "NursingSynLifeType",
      }).then((res) => {
        this.timesynchronism = res.data.beginTime;
        this.timesynchronismover = res.data.endTime;
        this.frequency = res.data.settingContent;
        this.statusover = res.data.onOff;
        this.idsss = res.data.id;
      });
      // this.timesynchronism =
      //   year + "-" + month + "-" + day + " " + hh + ":" + mm + ":" + ss;
    },
    chageSwith() {
      NursingUpdateOnOrOff({
        patientId: this.data.patient_id,
        beginTime: this.timesynchronism,
        endTime: this.timesynchronismover,
        settingContent: this.frequency,
        settingType: "NursingSynLifeType",
        onOff: this.statusover,
        id: this.idsss,
      }).then((res) => {
        if (res.code == 200) {
          Message({
            message: "保存成功",
            type: "success",
            duration: 1500,
          });
        } else {
          Message({
            message: "更新失败，请先保存频率",
            type: "warning",
            duration: 1500,
          });
        }
      });
    },
    chageMaibo() {
      openPulseRecord({
        patientId: this.data.patient_id,
        openStatus: this.statusmaibo,
      }).then((res) => {
        if (this.data.patient_id) {
          Message({
            message: "修改成功",
            type: "success",
            duration: 1500,
          });
        } else {
          Message({
            message: "请选择病人",
            type: "warning",
            duration: 1500,
          });
        }
      });
    },
    synchronismClick() {
      updateDefaultPage({
        patientId: this.data.patient_id,
        beginTime: this.timesynchronism,
        endTime: this.timesynchronismover,
        settingContent: this.frequency,
        settingType: "NursingSynLifeType",
        id: this.idsss,
      }).then((res) => {});
    },
    //评分
    checkout(shiguang, index) {
      if (this.editIndex != -1 && this.editIndex == index) {
        this.wanxiangtianying = true;
        getListByScoreName({ scoreName: "Glasgow昏迷评分(语言反应V)" }).then(
          (res) => {
            this.equipments = res.data;
            this.timepingfen =
              shiguang.row.date + " " + shiguang.row.time + ":00";
            if (shiguang.row.glasgow) {
              this.num = shiguang.row.glasgow;
              this.checkedEquipments[0] = parseInt(
                this.dataArray[index].glasgow
              );
            }
            this.nursesignature = shiguang.row.signature;
          }
        );
        getPatientScoreList({
          type: "glasgow-v",
          patientId: this.data.patient_id,
        }).then((res) => {
          this.tableDatalist = res.data;
        });
      }
    },
    handleChange() {
      let number = 0;

      this.checkedEquipments.map((item, index) => {
        if (!isNaN(item)) {
          number += item;
        }
      });
      this.num = number;

      this.checkEquipArr = [];
      let arr = this.checkedEquipments;
      for (let i = 0; i < arr.length; i++) {
        let equipment = arr[i];
        if (equipment.length > 0) {
          let obj = {
            id: this.equipments[i],
            equips: [],
          };
          for (let j = 0; j < equipment.length; j++) {
            obj.equips.push(equipment[j]);
          }
          this.checkEquipArr.push(obj);
        }
      }
    },
    radioChang(item, index) {
      this.radioChekObj[index] = item;
      this.itemId = item.id;
      this.parentId = item.parentId;
    },
    preservation() {
      if (!this.nursesignature) {
        alert("请先选择签名");
      } else {
        let radioChekList = [];
        if (Object.keys(this.radioChekObj).length !== 0) {
          this.radioList = Object.values(this.radioChekObj);
          this.radioList.map((it) => {
            radioChekList.push({
              itemId: it.id,
              parentId: it.parentId,
              content: "",
              extraContent: "",
            });
          });
        }
        if (this.editIndex >= 0 && this.editIndex < this.dataArray.length) {
          this.dataArray[this.editIndex].glasgow = this.num;
        }
        return;
        vitalSignSaveData({
          visitId: this.data.visit_id,
          visitCode: this.data.visit_code,
          patientId: this.data.patient_id,
          dataTime: this.timepingfen,
          code: "glasgow",
          content: this.num,
          glasgowMap: {
            visitId: this.data.visit_id,
            visitCode: this.data.visit_code,
            patientId: this.data.patient_id,
            type: "glasgow-v",
            scoreTime: this.timepingfen,
            score: parseInt(this.num),
            scoreKnowledgeId: this.score,
            reportTime: "",
            assessmentTime: "",
            nursingStep: "",
            otherStep: this.desc,
            signature: this.nursesignature,
            mortalityRate: "",
            extendColumn: "",
            list: JSON.stringify(radioChekList),
          },
        }).then((res) => {
          this.queryVitalSign();
        });
      }
    },

    //============以下用于录入======================
    getFullDate(date) {
      var str = "" + date.getFullYear();

      if (date.getMonth() < 9) str += "-0" + (date.getMonth() + 1);
      else str += "-" + (date.getMonth() + 1);

      if (date.getDate() < 10) str += "-0" + date.getDate();
      else str += "-" + date.getDate();

      if (date.getHours() < 10) str += " 0" + date.getHours();
      else str += " " + date.getHours();

      if (date.getMinutes() < 10) str += ":0" + date.getMinutes();
      else str += ":" + date.getMinutes();

      if (date.getSeconds() < 10) str += ":0" + date.getSeconds();
      else str += ":" + date.getSeconds();

      return str;
    },
    getShortTime(date) {
      if (date.getHours < 10) var str = "0" + date.getHours();
      else var str = "" + date.getHours();

      if (date.getMinutes() < 10) str += ":0" + date.getMinutes();
      else str += ":" + date.getMinutes();

      return str;
    },
    //检查日期格式,允许 2021-01-01 和 21-01-01两种格式，字符型
    //错误格式或值返回空
    //格式及值都正确，返回4位年的日期：2021-01-01，字符型
    formattedDate(dateStr) {
      if (typeof dateStr != "string" || dateStr.length < 8) return "";
      var tArray = dateStr.split("-");
      var n = tArray.length;

      if (n != 3) return "";
      for (var i = 0; i < n; i++) {
        if (tArray[i].length == 0) return "";
      }
      var year = parseInt(tArray[0]);
      if (year < 200) year += 2000;
      else if (year < 2000) return "";

      if (parseInt(tArray[1]) < 0 || parseInt(tArray[1]) > 11) return "";
      if (parseInt(tArray[2]) < 1 || parseInt(tArray[2]) > 31) return "";
      var str = year + "-" + tArray[1] + "-" + tArray[2];

      if (Date.parse(str)) return str;
      else return "";
    },
    //检查时间格式,允许 12:12,12:12:10,12:12:12:500三种格式，字符型
    //错误格式或值返回空
    //格式及值都正确，返回完整时间：12:12:10，字符型，毫秒忽略
    formattedTime(timeStr) {
      if (typeof timeStr != "string" || timeStr.length < 3) return "";
      var tArray = timeStr.split(":");
      var n = tArray.length;

      if (n < 2) return "";
      for (var i = 0; i < n; i++) {
        if (tArray[i].length == 0) return "";
      }
      if (parseInt(tArray[0]) < 0 || parseInt(tArray[0]) > 23) return "";
      if (parseInt(tArray[1]) < 0 || parseInt(tArray[1]) > 59) return "";
      if (n == 2) return timeStr + ":00";
      if (n > 2) {
        if (parseInt(tArray[2]) < 0 || parseInt(tArray[2]) > 59) return "";
        else return tArray[0] + ":" + tArray[1] + ":" + tArray[2];
      }
    },
    //检查日期时间格式，支持: 2021-08-08 12:12:12,2021-08-08 12:12, 3: 21-08-08 12:12:12, 4: 21-08-08 12:12
    //错误返回空，正确返回标准格式：2021-08-08 12:12:10,字符型
    formattedDateTime(dtStr) {
      var n = dtStr.indexOf(" ");
      if (n < 0) n = dtStr.indexOf(",");
      if (n < 0) return "";

      var ddd = this.formattedDate(dtStr.slice(0, n));
      if (ddd.length < 1) return "";

      var ttt = this.formattedTime(dtStr.slice(n + 1));
      if (ttt.length < 1) return "";

      return ddd + " " + ttt;
    },

    //检查输入的时间是否在允许修改期间
    insideRevisableTerm(dtStr) {
      if (typeof dtStr == "string" && dtStr.length > 5) {
      } else return false;

      var dateTime = new Date(dtStr);
      var ticks = dateTime.getTime();
      var currTicks = new Date().getTime();

      if (currTicks > ticks + this.revisableDays * 24 * 3600000) return false;
      return true;
    },
    //根据时间和签名判断是否允许编辑
    isRowEditable(index) {
      if (index < 0) return false;

      if (this.user_name != this.dataArray[index].signature) {
        //alert("非本人签名,不允许修改和删除");
        //return;
      }

      if (this.dataArray[index].dataTime.length < 1) {
        return false;
      }

      var dtStr = this.formattedDateTime(this.dataArray[index].dataTime);

      //如果日期时间格式错误，允许编辑，否则看保护时间
      if (dtStr.length > 0) {
        if (this.insideRevisableTerm(dtStr)) return true;
        alert("超过" + this.revisableDays + "天的数据，不允许再修改");
        return false;
      }
      //else alert("日期时间格式错误");
      return true;
    },
    //记录日期时间变化
    datetimeChanged(name, index) {
      if (typeof name == "string" && name != null && name.length > 0) {
        if (this.changedFields.indexOf(name) < 0) this.changedFields.push(name);
      }
    },

    //记录输入变化项: el-input,el-textarea,el-select
    inputChanged(ev, index) {
      return; //放弃这种方式
      if (typeof ev != "object") return;
      var name = ev.target.getAttribute("name");
      if (name == null || name.length < 1)
        name = ev.target.parentNode.getAttribute("name");
      if (name == null || name.length < 1)
        name = ev.target.parentNode.parentNode.getAttribute("name");
      if (name == null || name.length < 1)
        name = ev.target.parentNode.parentNode.parentNode.getAttribute("name");

      if (name != null && name.length > 0) {
        if (this.changedFields.indexOf(name) < 0) this.changedFields.push(name);
      }
    },
    //多行文本输入自动调整行高
    textAreaChanging(ev, index) {
      document.body.style.setProperty(
        "--editRowHeight",
        ev.target.scrollHeight + "px"
      );
    },
    //添加空数据行，无实质内容，除了时间和签名
    addEmptyRow() {
      if (typeof this.dataArray != "undefined") {
        if (this.dataArray.length > 0) {
          if (this.isEmptyRow(this.dataArray.length - 1)) return;
        }

        var item = new Object();

        item.index = this.dataArray.length;
        var date = new Date();
        item.dataTime = this.getFullDate(date);
        //item.glasgow = "无";
        //this.$set(this.dataArray, this.dataArray.length, item);
        this.dataArray.push(item); // = this.dataArray;
        //滚到最后
        this.$nextTick(() => {
          let container = this.$el.querySelector(".el-table__body-wrapper");
          container.scrollTop = container.scrollHeight;
        });
        this.$forceUpdate();
      }
    },
    //进入编辑样式
    enterEditStyle(index, cell) {
      if (this.editRowHeight == "integer" && parseInt(this.editRowHeight) > 10)
        var height = this.editRowHeight;
      else var height = 40;

      var obj = cell;
      while (
        typeof obj == "object" &&
        typeof obj.tagName.toLowerCase() == "string"
      ) {
        if (obj.tagName.toLowerCase() == "tr") {
          height = obj.clientHeight;
          break;
        } else if (obj.tagName.toLowerCase() == "tbody") break;
        else obj = obj.parentNode;
      }
      this.editRowHeight = height;
      document.body.style.setProperty("--editRowHeight", height + "px");
    },

    restoreRowStyle(index) {},

    //该行是否无有效输入，实质内容为空?
    isEmptyRow(index) {
      if (index < 0 || typeof this.dataArray != "object") return true;
      var jsRowData = JSON.parse(JSON.stringify(this.dataArray[index]));
      for (var item in jsRowData) {
        if (this.ignoredKeys != null && this.ignoredKeys.indexOf(item) >= 0) {
        } else if (
          typeof jsRowData[item] != "undefined" &&
          jsRowData[item].toString().length > 0
        ) {
          return false;
        }
      }
      return true;
    },
    cellClassName({ row, column, columnIndex }) {
      column.index = columnIndex;
    },
    tableRowClassName({ row, rowIndex }) {
      //把每一行的索引放进row
      if (typeof row == "undefined") return "";
      row.index = rowIndex;
      if (rowIndex == this.editIndex) return "edit-line";
      else return "";
    },

    rowDbClick(row, column, ev) {
      //判断是否允许双击
      if (this.actionColumnFlag == false) return;
      if (row.signature == "") {
        row.signature = "无";
      }
      if (row.signature_again == "") {
        row.signature_again = "无";
      }
      if (typeof row == "undefined") return;
      if (row.index == this.editIndex) {
        /*是否双击直接退出编辑，待使用效果决定
        this.$set(this.dataArray, row.index, this.lastRowData);
        document.body.style.setProperty(
          "--editRowHeight",
          this.editRowHeight + "px"
        );
        this.editIndex = -1;
        */
        return;
      }

      if (this.editIndex >= 0) {
        alert("前次编辑未结束!");
        return;
      }
      if (!this.isRowEditable(row.index)) return;
      //保存旧数据
      this.changedFields = [];
      this.lastRowData = JSON.parse(JSON.stringify(this.dataArray[row.index]));
      this.enterEditStyle(row.index, ev.target);
      this.editIndex = row.index;
    },

    // 点击行编辑
    editButtonClick(index, ev, row) {
      if (this.editIndex >= 0) {
        alert("前次编辑未结束!");
        return;
      }
      console.log("小鸡腿", row);
      if (index == this.editIndex) return;
      if (!this.isRowEditable(index)) return;
      //保存旧数据
      this.changedFields = [];
      this.lastRowData = JSON.parse(JSON.stringify(this.dataArray[index]));

      var height = this.editRowHeight;
      var obj = ev.target.parentNode;
      this.enterEditStyle(index, ev.target.parentNode);
      this.editIndex = index;
      //this.$forceUpdate();
    },
    deleteButtonClick(index, scope) {
      if (this.editIndex >= 0) {
        alert("前次编辑未结束!");
        return;
      }
      if (!this.isRowEditable(index)) return;

      if (!confirm("确认删除吗?")) return;

      crrtNursedelete({
        id: scope.row.id,
        status: 1,
        patientId: this.data.patient_id,
      }).then((res) => {
        this.dataArray = res.data;
        if(!this.dataArray) {
          this.dataArray=[];
        }
        console.log(this.dataArray);
        this.$message({
          message: "删除成功",
          type: "success",
        });
        this.queryVitalSign();
      });
      this.changedFields = [];
      this.editIndex = -1;
    },
    saveButtonClick(indexOne, index) {
      if (index < 0) return;

      var dtStr = this.formattedDateTime(this.dataArray[index].dataTime);

      if (dtStr.length < 1) {
        alert("日期时间格式错误");
        return;
      }

      if (this.isEmptyRow(index)) {
        alert("空行不能保存");
        return;
      }

      // if (
      //   JSON.stringify(this.dataArray[index]) ==
      //   JSON.stringify(this.lastRowData)
      // ) {
      //   alert("值未变化");
      //   this.editIndex = -1;
      //   return;
      // }

      // if (!confirm("确认保存吗?")) return;

      this.insertRow(indexOne, index);

      var hours = "" + this.correctSettings();

      var milSecond = new Date(
        this.settings.startDate + " " + this.settings.startTime
      ).getTime();
      var newMilSecond = new Date(dtStr).getTime();

      if (newMilSecond > milSecond + hours * 3600000 - 1000) {
        var newStartMilSecond = newMilSecond - hours * 3600000;

        this.settings.startDate = this.getFullDate(new Date(newStartMilSecond));
        //this.settings.startDate = this.formattedDate(
        //this.dataArray[index].date
        //);
        this.$emit("update:settings", this.settings);
      }

      setTimeout(() => {
        this.queryVitalSign();
      }, 0);

      this.editIndex = -1;

      if (
        this.dataArray.length > 0 &&
        !this.isEmptyRow(this.dataArray.length - 1)
      ) {
        //this.addEmptyRow();
        //报错
        if (this.dataArray.length > 0) {
          //保存旧数据
          //this.lastRowData = JSON.parse(JSON.stringify(this.arr.length - 1));
          //this.$forceUpdate();
          //this.enterEditStyle(this.arr.length - 1);
          //this.editIndex=this.arr.length - 1;
        }
      }
    },
    reverseButtonClick(index) {
      if (index < 0) return;

      if (
        JSON.stringify(this.dataArray[index]) !=
        JSON.stringify(this.lastRowData)
      ) {
        if (!this.isEmptyRow(index)) {
          if (!confirm("确认放弃修改, 恢复原值吗?")) return;
        }
      }
      this.$set(this.dataArray, index, this.lastRowData);
      document.body.style.setProperty(
        "--editRowHeight",
        this.editRowHeight + "px"
      );
      this.editIndex = -1;
    },
    ///////////////////////////上面是编辑逻辑控制-----------------------
    appendNew() {
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        this.$message({
          message: "请先选择病人",
          type: "warning",
        });
        return;
      } else {
        if (this.editIndex >= 0) {
          alert("前次编辑未结束!");
          return;
        }
        console.log("鸡腿");
        this.addEmptyRow();
      }
      //this.editIndex = this.dataArray.length - 1;
    },
    signaturesqm(scope) {
      var dtStr = this.formattedDateTime(scope.row.date + " " + scope.row.time);
      vitalSignSaveData({
        visitId: this.data.visit_id,
        visitCode: this.data.visit_code,
        patientId: this.data.patient_id,
        dataTime: dtStr,
        code: "signature",
        content: scope.row.signature,
      }).then((res) => {
        this.queryVitalSign();
      });
      this.editIndex = -1;
    },

    insertRow(insertRow, index) {
      console.log("你是老购买", insertRow.row.id);
      if (
        index < 0 ||
        typeof this.dataArray != "object" ||
        this.dataArray.length <= index
      )
        return;
      var dtStr = this.formattedDateTime(
        this.dataArray[index].date + " " + this.dataArray[index].time
      );
      var dtStr0 = this.formattedDateTime(
        this.lastRowData["date"] + " " + this.lastRowData["time"]
      );
      this.data = this.$store.state.user.severFall;
      if (!insertRow.row.id) {
        crrtNurseinsertThree({
          visitId: this.data.visit_id,
          visitCode: this.data.visit_code,
          patientId: this.data.patient_id,
          dataTime: insertRow.row.dataTime,
          endTime: insertRow.row.endTime,
          ultrafiltrationQuantity: insertRow.row.ultrafiltrationQuantity,
          signature: insertRow.row.signature,
        }).then((res) => {
          this.dataArray = res.data;
          if (res.code === 200) {
            console.log(res);
            this.$message({
              message: res.msg,
              type: "success",
              duration: 1000,
            });
          } else {
            this.$message({
              message: res.msg,
              type: "error",
              duration: 1000,
            });
          }
          this.queryVitalSign();
        });
      } else {
        crrtNurseinsertThree({
          id: insertRow.row.id,
          visitId: this.data.visit_id,
          visitCode: this.data.visit_code,
          patientId: this.data.patient_id,
          dataTime: insertRow.row.dataTime,
          endTime: insertRow.row.endTime,
          ultrafiltrationQuantity: insertRow.row.ultrafiltrationQuantity,
          signature: insertRow.row.signature,
          status: insertRow.row.status,
          type: insertRow.row.type,
        }).then((res) => {
          this.dataArray = res.data;
          if (res.code === 200) {
            console.log(res);
            this.$message({
              message: res.msg,
              type: "success",
              duration: 1000,
            });
          } else {
            this.$message({
              message: res.msg,
              type: "error",
              duration: 1000,
            });
          }
          this.queryVitalSign();
        });
      }
      this.changedObjList = [];
      var rowItems = JSON.parse(JSON.stringify(this.dataArray[index]));
      for (var item in rowItems) {
        if (
          rowItems[item] != this.lastRowData[item] ||
          dtStr != dtStr0 ||
          item == "signature"
        ) {
          if (item == "date" || item == "time") continue;

          //

          // obj.content = rowItems[item];
          // if (Array.isArray(obj.content)) {
          //   obj.content = obj.content.toString();
          // }

          // if (this.dataArray[index].row_id) {
          //   obj.rowId = this.dataArray[index].row_id;
          // } else {
          //   obj.rowId = "add";
          // }

          // let radioChekList = [];
          // if (Object.keys(this.radioChekObj).length !== 0) {
          //   this.radioList = Object.values(this.radioChekObj);
          //   this.radioList.map((it) => {
          //     radioChekList.push({
          //       itemId: it.id,
          //       parentId: it.parentId,
          //       content: "",
          //       extraContent: "",
          //     });
          //   });
          // }
          // obj.glasgowMap = {
          //   visitId: this.data.visit_id,
          //   visitCode: this.data.visit_code,
          //   patientId: this.data.patient_id,
          //   type: "glasgow-v",
          //   scoreTime: this.timepingfen,
          //   score: parseInt(this.num),
          //   scoreKnowledgeId: this.score,
          //   reportTime: "",
          //   assessmentTime: "",
          //   nursingStep: "",
          //   otherStep: this.desc,
          //   signature: this.nursesignature,
          //   mortalityRate: "",
          //   extendColumn: "",

          //   //

          //   list: JSON.stringify(radioChekList),
          // };
        }
      } //for
      // vitalSignSaveDataxin(this.changedObjList).then((response) => {
      //   this.queryVitalSign();
      // });
    }, //insertRow
    correctSettings() {
      var dtStr = this.formattedTime(this.settings.startTime);
      if (dtStr == "") this.settings.startTime = "07:00:00";
      var dtStr = this.formattedDate(this.settings.startDate);
      if (dtStr == "") this.settings.startDate = this.getFullDate(new Date());

      var timeSpan = parseInt(this.settings.timeSpan);
      if (isNaN(timeSpan) || timeSpan < 1) {
        if (this.settings.timeType == "天") this.settings.timeSpan = 1;
        else this.settings.timeSpan = 24;
        var hours = 24;
      } else {
        if (this.settings.timeType == "天") var hours = timeSpan * 24;
        else var hours = timeSpan;
      }
      return hours;
    },
    //根据病人id及时间获取全部生命体征
    queryVitalSign() {
      //显示操作列
      this.actionColumnFlag = true;
      //隐藏分页
      this.pageFlag = false;
      this.editIndex = -1;
      var date = new Date();
      //年
      var year = date.getFullYear();
      //月
      var month = date.getMonth() + 1;
      //日
      var day = date.getDate();
      //时
      var hh = date.getHours();
      //分
      var mm = date.getMinutes();
      //秒
      var ss = date.getSeconds();
      if (Number(month) < 10) {
        month = "0" + month;
      }
      if (Number(day) < 10) {
        day = "0" + day;
      }
      if (Number(hh) < 10) {
        hh = "0" + hh;
      }
      if (Number(mm) < 10) {
        mm = "0" + mm;
      }
      if (Number(ss) < 10) {
        ss = "0" + ss;
      }
      var datess = new Date();
      var hhss = datess.getHours();
      var toady =
        year + "-" + month + "-" + day + " " + hh + ":" + mm + ":" + ss;
      var compareDate =
        year + "-" + month + "-" + day + " " + "08" + ":" + "30" + ":" + "00";
      // if (hhss >= 7) {
      if (this.compare(toady, compareDate)) {
        //if (hh >= 7) {
        var dtStr = this.formattedDateTime(
          this.settings.startDate + " " + this.settings.startTime
        );
      } else {
        var date = new Date(this.settings.startDate.slice(0, 10));
        date.setDate(date.getDate() - 1);
        var years = date.getFullYear();
        var months = date.getMonth() + 1;
        var days = date.getDate();
        /**
         var years = this.settings.startDate.slice(0, 4);
         var months = this.settings.startDate.slice(5, 7);
         var days = this.settings.startDate.slice(8, 10);
         days = days - 1;
         **/
        if (Number(months) < 10) {
          months = "0" + months;
        }
        if (Number(days) < 10) {
          days = "0" + days;
        }
        this.xinshidai = years + "-" + months + "-" + days;
        var dtStr = this.formattedDateTime(
          this.xinshidai + " " + this.settings.startTime
        );
      }
      // var dtStr = this.formattedDateTime(
      //   this.settings.startDate + " " + this.settings.startTime
      // );
      /**
      if (dtStr.length < 1) {
        alert("查询日期/时间格式错误!");
        return true;
      }
       **/
      //this.getTailContent();
      this.data = this.$store.state.user.severFall;
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        alert("请选择一次病人");
        return;
      }

      this.hours = "" + this.correctSettings();

      crrtNursequeryThreeList({
        patientId: this.data.patient_id,
        startTime: dtStr,
        hour: this.hours,
      })
        .then((res) => {
          if (res.data) {
            this.dataArray = res.data;
            this.settings.loading = false;
          } else {
            this.dataAarray = [];
            this.settings.loading = false;
          }
        })
        .catch((err) => {
          this.settings.loading = false;
        });
    },
    //根据病人id及入科时间，获得自病人入科以来的全部数据，并打印
    //使用当前时间减去入科时间计算时间间隔
    getHours() {
      var dtStr =
        this.formattedDate(this.data.enter_time).slice(0, 10) + " 00:00:00";
      var enter_time = new Date(dtStr).getTime();
      var today = new Date().getTime();
      var hours = Math.ceil((today - enter_time) / (1000 * 3600));
      return hours;
    },
    queryAndPrintAll() {
      this.loading = true;
      this.data = this.$store.state.user.severFall;
      var dtStr =
        this.formattedDate(this.data.enter_time).slice(0, 10) + " 00:00:00";
      /**
      this.hours = "" + this.correctSettings();
      var dtStr = this.formattedDate(this.data.enter_time);

      if (dtStr.length < 8) dtStr = "2021-09-01 00:00:00";
      else dtStr += " 00:00:00";
      var myDate = new Date();
      myDate.setDate(myDate.getDate() + 1);

      var hours = 10000;
      **/
      var hours = this.getHours(this.data.enter_time);
      //console.log(hours,"时间间隔=============")
      let thus = this;
      vitalSignGetList({
        patientId: this.data.patient_id,
        startTime: dtStr,
        hour: hours,
      })
        .then((res) => {
          if (res.data) {
            this.printArray = res.data;
            this.$nextTick(function () {
              this.printOut();
              this.loading = false;
            });
          } else {
            this.loading = false;
            this.printAarray = [];
            alert("未查到条数据!");
          }
        })
        .catch((error) => {
          this.loading = false;
        });
    },
    //获得所有选项
    getAllOptions() {
            getUserListByUserType().then((res) => {
        this.arrUserName = res.data;
      });
      /**
      getCodeListByName({ status: 1, commonName: "出量" }).then((res) => {
        this.arrList = res.data;
      });
      getCodeListByName({ status: 1, commonName: "入量" }).then((res) => {
        this.arrListru = res.data;
      });
      getCodeListByName({ status: 1, commonName: "给药途径" }).then((res) => {
        this.arrListgeiyao = res.data;
      });
      getCodeListByName({ status: 1, commonName: "神志" }).then((res) => {
        this.shenzhi = res.data;
      });
      getCodeListByName({ status: 1, commonName: "瞳孔大小" }).then((res) => {
        this.pupleft = res.data;
        this.pupright = res.data;
      });
       **/
      getCodeListByName({ status: 1, commonName: "瞳孔反射" }).then((res) => {
        this.light = res.data;
      });
      /**
      getCodeListByName({ status: 1, commonName: "心律" }).then((res) => {
        this.heart = res.data;
      });
      getCodeListByName({ status: 1, commonName: "人工气道方式" }).then(
        (res) => {
          this.airWay = res.data;
        }
      );
       **/
      getCodeListByName({ status: 1, commonName: "机械通气模式" }).then(
        (res) => {
          this.rsModels = res.data;
        }
      );
      /**
      getCodeListByName({ status: 1, commonName: "呼吸音" }).then((res) => {
        this.huxiyin = res.data;
      });
       **/
      getCodeListByName({ status: 1, commonName: "吸氧方式" }).then((res) => {
        this.xiyan = res.data;
      });
    },
    getTailContent() {
      //if( this.tailContent.length>20 ) return;
      this.tailContent = "";

      var fontColor =
        " style='color:red; font-family:\"黑体\";font-size:15px;' ";
      this.tailContent = "<span " + fontColor + ">说明：&nbsp;</span>";

      if (typeof this.heart == "object") {
        if (this.heart.length > 0)
          this.tailContent += "<span " + fontColor + ">心律：</span>";
        for (var i = 0; i < this.heart.length; i++) {
          this.tailContent +=
            this.heart[i].itemName +
            "-" +
            this.heart[i].description +
            ";&nbsp;";
        }
      }

      this.tailContent += "&nbsp;&nbsp;";
      if (typeof this.shenzhi == "object") {
        if (this.shenzhi.length > 0)
          this.tailContent += "<span " + fontColor + ">神志：</span>";
        for (var i = 0; i < this.shenzhi.length; i++) {
          this.tailContent +=
            this.shenzhi[i].itemName +
            "-" +
            this.shenzhi[i].description +
            ";&nbsp;";
        }
      }
      this.tailContent += "&nbsp;&nbsp;";
      if (typeof this.light == "object") {
        if (this.light.length > 0)
          this.tailContent += "<span " + fontColor + ">瞳孔反射：</span>";
        for (var i = 0; i < this.light.length; i++) {
          this.tailContent +=
            this.light[i].itemName +
            "-" +
            this.light[i].description +
            ";&nbsp;";
        }
      }
      this.tailContent += "&nbsp;&nbsp";
      if (typeof this.airWay == "object") {
        if (this.airWay.length > 0)
          this.tailContent += "<span " + fontColor + ">人工气道方式：</span>";
        for (var i = 0; i < this.airWay.length; i++) {
          this.tailContent +=
            this.airWay[i].itemName +
            "-" +
            this.airWay[i].description +
            ";&nbsp;";
        }
      }
      this.tailContent += "&nbsp;&nbsp;";
      if (typeof this.huxiyin == "object") {
        if (this.huxiyin.length > 0)
          this.tailContent += "<span " + fontColor + ">呼吸音：</span>";
        for (var i = 0; i < this.huxiyin.length; i++) {
          this.tailContent +=
            this.huxiyin[i].itemName +
            "-" +
            this.huxiyin[i].description +
            ";&nbsp;";
        }
      }

      this.tailContent += "&nbsp;&nbsp;";
      if (typeof this.xiyan == "object") {
        if (this.xiyan.length > 0)
          this.tailContent += "<span " + fontColor + ">吸氧方式：</span>";
        for (var i = 0; i < this.xiyan.length; i++) {
          this.tailContent +=
            this.xiyan[i].itemName +
            "-" +
            this.xiyan[i].description +
            ";&nbsp;";
        }
      }
    },
    //自定义下拉框
    renderLastHeader(h) {
      //下拉框选项
      let filters = [
        { text: "呕吐2222222222", value: "呕吐222222222222222" },
        { text: "呕吐1", value: "呕吐1" },
        { text: "呕吐2", value: "呕吐2" },
        { text: "呕吐3", value: "呕吐3" },
      ];
      //下拉框内容包裹在一个div里面
      return h(
        "div",
        {
          style: {
            height: "56px",
          },
        },
        [
          h(
            "span",
            {
              //div里面有一个文字提示：下拉框所属内容
              style: {},
              class: "level-font-class",
            },
            ""
          ),
          h(
            "el-select",
            {
              //el-select实现下拉框
              on: {
                input: (value) => {
                  //随着下拉框的不同，文字框里的内容在边
                  this.logLevel = value;
                },
              },
              props: {
                value: this.logLevel, //文字框的内容取决于这个value，如果value不存在，会报错
              },
            },
            [
              //下拉框里面填充选项，通过filters遍历map，为每一个选项赋值。
              filters.map((item) => {
                return h("el-option", {
                  props: {
                    value: item.value,
                    label: item.text,
                  },
                });
              }),
            ]
          ),
        ]
      );
    },
  },
};
</script>
<style >
.bazhu {
  margin-bottom: 12px;
  float: right;
  font-size: 12px;
}
.over {
  margin-top: 15px;
}
body .el-table th.gutter {
  display: table-cell !important;
}
</style>
<style>
.mod_box {
  margin-top: -60px;
  width: 75%;
  margin-left: 15%;
}
.customer-table {
  border-top: 1px solid #000;
  border-left: 1px solid #000;
  border-bottom: 1px solid #000;
}
.customer-table td,
.customer-table th.is-leaf,
.customer-table thead.is-group th {
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
}
.customer-table .el-table__empty-block {
  border-right: 1px solid #000;
}
</style>
<style  lang="scss" scoped>
::v-deep .el-table td {
  padding-top: 0px;
  padding-bottom: 0px;
  vertical-align: middle !important;
}
::v-deep .el-input__inner {
  padding: 0px;
  margin: 0px;
  border: none;
  outline: none;
  border-radius: 0px;
  color: red;
  background-color: rgb(250 249 222);
}
::v-deep .overgalaxi .el-input__inner {
  width: 250px;
}
::v-deep .el-input__icon.el-icon-date {
  width: 0;
  height: 0;
  overflow: hidden;
}
::v-deep .el-input__icon.el-icon-date:before {
  width: 0;
  height: 0;
}
::v-deep .el-input__icon.el-icon-time {
  width: 0;
  height: 0;
  overflow: hidden;
}
::v-deep .el-textarea__inner {
  padding: 0px;
  margin: 0px;
  border: none;
  outline: none;
  border-radius: 0px;
  color: red;
}
::v-deep .el-table .cell {
  white-space: pre-line;
  padding: 0 !important;
  vertical-align: middle;
}
::v-deep .edit-line .cell {
  padding: 0 !important;
  vertical-align: middle;
  height: var(--editRowHeight);
  position: relative;
  background-color: rgb(250 249 222);
}
::v-deep .edit-line .el-input__inner {
  padding: 0 !important;
  vertical-align: middle;
  height: var(--editRowHeight);
  line-height: var(--editRowHeight);
  color: red;
  background-color: rgb(250 249 222);
}

::v-deep .edit-line .el-textarea__inner {
  padding: 0 !important;
  vertical-align: middle;
  height: var(--editRowHeight);
  overflow: hidden;
  color: red;
  background-color: rgb(250 249 222);
}
::v-deep .edit-line .el-select__inner {
  color: red;
  background-color: rgb(250 249 222);
}
::v-deep .edit-line span {
  padding: 0 !important;
  vertical-align: middle;
  height: var(--editRowHeight);
  line-height: var(--editRowHeight);
}
</style>
